home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / SOURCE / LIBPNG / PNG.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-16  |  55.4 KB  |  1,417 lines  |  [TEXT/CWIE]

  1.  
  2. /* png.h - header file for png reference library
  3.  
  4.    libpng 1.0 beta 4 - version 0.90
  5.    January 10, 1997
  6.  
  7.    Note: This is a beta version.  It reads and writes valid files
  8.    on the platforms I have, and has had a wide testing program.
  9.    You may have to modify the includes below to get it to work on
  10.    your system, and you may have to supply the correct compiler
  11.    flags in the makefile, if you can't find a makefile suitable for
  12.    your operating system/compiler combination.  Read the libpng.txt
  13.    for more information, and how to contact the authors if you have any
  14.    problems, or if you want your compiler/platform to be supported
  15.    in the next official libpng release.
  16.  
  17.    See libpng.txt for more information.
  18.  
  19.    Copyright (c) 1995, 1996, 1997 Guy Eric Schalnat, Group 42, Inc.
  20.    Contributing Authors:
  21.       Sam Bushnell
  22.       Andreas Dilger
  23.       Dave Martindale
  24.       Guy Eric Schalnat
  25.       Paul Schmidt
  26.       Tim Wegner
  27.  
  28.    The contributing authors would like to thank all those who helped
  29.    with testing, bug fixes, and patience.  You know who you are.  This
  30.    wouldn't have been possible without all of you.
  31.  
  32.    Thanks to Frank J. T. Wojcik for helping with the documentation
  33.  
  34.    The PNG Reference Library is supplied "AS IS". The Contributing Authors
  35.    and Group 42, Inc. disclaim all warranties, expressed or implied,
  36.    including, without limitation, the warranties of merchantability and of
  37.    fitness for any purpose. The Contributing Authors and Group 42, Inc.
  38.    assume no liability for direct, indirect, incidental, special, exemplary,
  39.    or consequential damages, which may result from the use of the PNG
  40.    Reference Library, even if advised of the possibility of such damage.
  41.  
  42.    Permission is hereby granted to use, copy, modify, and distribute this
  43.    source code, or portions hereof, for any purpose, without fee, subject
  44.    to the following restrictions:
  45.    1. The origin of this source code must not be misrepresented.
  46.    2. Altered versions must be plainly marked as such and must not be
  47.       misrepresented as being the original source.
  48.    3. This Copyright notice may not be removed or altered from any source or
  49.       altered source distribution.
  50.  
  51.    The Contributing Authors and Group 42, Inc. specifically permit, without
  52.    fee, and encourage the use of this source code as a component to
  53.    supporting the PNG file format in commercial products. If you use this
  54.    source code in a product, acknowledgment is not required but would be
  55.    appreciated.
  56.    */
  57.  
  58. #ifndef _PNG_H
  59. #define _PNG_H
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65. /* This is not the place to learn how to use libpng.  The file libpng.txt
  66.    describes how to use libpng, and the file example.c summarizes it
  67.    with some code to build around.  This file is useful for looking
  68.    at the actual function definitions and structure components. */
  69.  
  70. /* include the compression library's header */
  71. #include "zlib.h"
  72.  
  73. /* include all user configurable info */
  74. #include "pngconf.h"
  75.  
  76. /* This file is arranged in several sections.  The first section details
  77.    the functions most users will use.  The third section describes the
  78.    stub files that users will most likely need to change.  The last
  79.    section contains functions used internally by the code.  */
  80.  
  81. /* version information for png.h - this should match the version
  82.    number in png.c */
  83. #define PNG_LIBPNG_VER_STRING "0.90"
  84. /* careful here.  I wanted to use 090, but that would be octal.  Version
  85.    1.0 will be 100 here, etc. */
  86. #define PNG_LIBPNG_VER 90
  87.  
  88. /* variables defined in png.c - only it needs to define PNG_NO_EXTERN */
  89. #ifndef PNG_NO_EXTERN
  90. /* version information for c files, stored in png.c. This better match
  91.    the version above. */
  92. extern char png_libpng_ver[];
  93. #endif
  94.  
  95. /* three color definitions.  The order of the red, green, and blue, (and the
  96.    exact size) is not important, although the size of the fields need to
  97.    be png_byte or png_uint_16 (as defined below).  */
  98. typedef struct png_color_struct
  99. {
  100.    png_byte red;
  101.    png_byte green;
  102.    png_byte blue;
  103. } png_color;
  104. typedef png_color       FAR *    png_colorp;
  105. typedef png_color       FAR * FAR * png_colorpp;
  106.  
  107. typedef struct png_color_16_struct
  108. {
  109.    png_byte index; /* used for palette files */
  110.    png_uint_16 red; /* for use in red green blue files */
  111.    png_uint_16 green;
  112.    png_uint_16 blue;
  113.    png_uint_16 gray; /* for use in grayscale files */
  114. } png_color_16;
  115. typedef png_color_16    FAR *    png_color_16p;
  116. typedef png_color_16    FAR * FAR * png_color_16pp;
  117.  
  118. typedef struct png_color_8_struct
  119. {
  120.    png_byte red; /* for use in red green blue files */
  121.    png_byte green;
  122.    png_byte blue;
  123.    png_byte gray; /* for use in grayscale files */
  124.    png_byte alpha; /* for alpha channel files */
  125. } png_color_8;
  126. typedef png_color_8     FAR *    png_color_8p;
  127. typedef png_color_8     FAR * FAR * png_color_8pp;
  128.  
  129. /* png_text holds the text in a png file, and whether they are compressed
  130.    or not.  If compression is -1, the text is not compressed.  */
  131. typedef struct png_text_struct
  132. {
  133.    int compression; /* compression value, -1 if uncompressed */
  134.    png_charp key; /* keyword */
  135.    png_charp text; /* comment */
  136.    png_uint_32 text_length; /* length of text field */
  137. } png_text;
  138. typedef png_text        FAR *    png_textp;
  139. typedef png_text        FAR * FAR * png_textpp;
  140.  
  141. /* png_time is a way to hold the time in an machine independent way.
  142.    Two conversions are provided, both from time_t and struct tm.  There
  143.    is no portable way to convert to either of these structures, as far
  144.    as I know.  If you know of a portable way, send it to me. */
  145. typedef struct png_time_struct
  146. {
  147.    png_uint_16 year; /* full year, as in, 1995 */
  148.    png_byte month; /* month of year, 1 - 12 */
  149.    png_byte day; /* day of month, 1 - 31 */
  150.    png_byte hour; /* hour of day, 0 - 23 */
  151.    png_byte minute; /* minute of hour, 0 - 59 */
  152.    png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
  153. } png_time;
  154. typedef png_time        FAR *    png_timep;
  155. typedef png_time        FAR * FAR * png_timepp;
  156.  
  157. /* png_info is a structure that holds the information in a png file.
  158.    If you are reading the file, This structure will tell you what is
  159.    in the png file.  If you are writing the file, fill in the information
  160.    you want to put into the png file, then call png_write_info().
  161.    The names chosen should be very close to the PNG specification, so
  162.    consult that document for information about the meaning of each field. */
  163. typedef struct png_info_struct
  164. {
  165.    /* the following are necessary for every png file */
  166.    png_uint_32 width; /* with of file */
  167.    png_uint_32 height; /* height of file */
  168.    png_uint_32 valid; /* the PNG_INFO_ defines, OR'd together */
  169.    png_uint_32 rowbytes; /* bytes needed for untransformed row */
  170.    png_colorp palette; /* palette of file */
  171.    png_uint_16 num_palette; /* number of values in palette */
  172.    png_uint_16 num_trans; /* number of trans values */
  173.    png_byte bit_depth; /* 1, 2, 4, 8, or 16 */
  174.    png_byte color_type; /* use the PNG_COLOR_TYPE_ defines */
  175.    png_byte compression_type; /* must be 0 */
  176.    png_byte filter_type; /* must be 0 */
  177.    png_byte interlace_type; /* 0 for non-interlaced, 1 for interlaced */
  178.    /* the following is informational only on read, and not used on
  179.       writes */
  180.    png_byte channels; /* number of channels of data per pixel */
  181.    png_byte pixel_depth; /* number of bits per pixel */
  182.    png_byte spare_byte;  /* To align the data, and for future use */
  183.    png_byte signature[8]; /* Signature read from start of file */
  184.  
  185.    /* the rest are optional.  If you are reading, check the valid
  186.       field to see if the information in these are valid.  If you
  187.       are writing, set the valid field to those chunks you want
  188.       written, and initialize the appropriate fields below */
  189. #if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_WRITE_gAMA_SUPPORTED)
  190.    float gamma; /* gamma value of file, if gAMA chunk is valid */
  191. #endif
  192. #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
  193.     defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
  194.    int num_text; /* number of comments */
  195.    int max_text; /* size of text array */
  196.    png_textp text; /* array of comments */
  197. #endif
  198. #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
  199.    png_time mod_time; /* modification time */
  200. #endif
  201. #if defined(PNG_READ_sBIT_SUPPORTED) || defined(PNG_WRITE_sBIT_SUPPORTED)
  202.    png_color_8 sig_bit; /* significant bits */
  203. #endif
  204. #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_WRITE_tRNS_SUPPORTED)
  205.    png_bytep trans; /* tRNS values for palette image */
  206.    png_color_16 trans_values; /* tRNS values for non-palette image */
  207. #endif
  208. #if defined(PNG_READ_bKGD_SUPPORTED) || defined(PNG_WRITE_bKGD_SUPPORTED)
  209.    png_color_16 background; /* background color of image */
  210. #endif
  211. #if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
  212.    png_uint_32 x_offset; /* x offset on page */
  213.    png_uint_32 y_offset; /* y offset on page */
  214.    png_byte offset_unit_type; /* offset units type */
  215. #endif
  216. #if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
  217.    png_uint_32 x_pixels_per_unit; /* x resolution */
  218.    png_uint_32 y_pixels_per_unit; /* y resolution */
  219.    png_byte phys_unit_type; /* resolution type */
  220. #endif
  221. #if defined(PNG_READ_hIST_SUPPORTED) || defined(PNG_WRITE_hIST_SUPPORTED)
  222.    png_uint_16p hist; /* histogram of palette usage */
  223. #endif
  224. #if defined(PNG_READ_cHRM_SUPPORTED) || defined(PNG_WRITE_cHRM_SUPPORTED)
  225.    float x_white; /* cHRM chunk values */
  226.    float y_white;
  227.    float x_red;
  228.    float y_red;
  229.    float x_green;
  230.    float y_green;
  231.    float x_blue;
  232.    float y_blue;
  233. #endif
  234. } png_info;
  235. typedef png_info        FAR *    png_infop;
  236. typedef png_info        FAR * FAR * png_infopp;
  237.  
  238. #define PNG_RESOLUTION_UNKNOWN 0
  239. #define PNG_RESOLUTION_METER   1
  240. #define PNG_RESOLUTION_LAST    2
  241.  
  242. #define PNG_OFFSET_PIXEL       0
  243. #define PNG_OFFSET_MICROMETER  1
  244. #define PNG_OFFSET_LAST        2
  245.  
  246. /* these describe the color_type field in png_info */
  247.  
  248. /* color type masks */
  249. #define PNG_COLOR_MASK_PALETTE 1
  250. #define PNG_COLOR_MASK_COLOR   2
  251. #define PNG_COLOR_MASK_ALPHA   4
  252.  
  253. /* color types.  Note that not all combinations are legal */
  254. #define PNG_COLOR_TYPE_GRAY 0
  255. #define PNG_COLOR_TYPE_PALETTE \
  256.    (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  257. #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
  258. #define PNG_COLOR_TYPE_RGB_ALPHA \
  259.    (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  260. #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  261.  
  262. /* These determine if a chunks information is present in a read operation, or
  263.    if the chunk should be written in a write operation.  */
  264. #define PNG_INFO_gAMA 0x0001
  265. #define PNG_INFO_sBIT 0x0002
  266. #define PNG_INFO_cHRM 0x0004
  267. #define PNG_INFO_PLTE 0x0008
  268. #define PNG_INFO_tRNS 0x0010
  269. #define PNG_INFO_bKGD 0x0020
  270. #define PNG_INFO_hIST 0x0040
  271. #define PNG_INFO_pHYs 0x0080
  272. #define PNG_INFO_oFFs 0x0100
  273. #define PNG_INFO_tIME 0x0200
  274.  
  275. /* this is used for the transformation routines, as some of them
  276.    change these values for the row.  It also should enable using
  277.    the routines for other uses. */
  278. typedef struct png_row_info_struct
  279. {
  280.    png_uint_32 width; /* width of row */
  281.    png_uint_32 rowbytes; /* number of bytes in row */
  282.    png_byte color_type; /* color type of row */
  283.    png_byte bit_depth; /* bit depth of row */
  284.    png_byte channels; /* number of channels (1, 2, 3, or 4) */
  285.    png_byte pixel_depth; /* bits per pixel (depth * channels) */
  286. } png_row_info;
  287.  
  288. typedef png_row_info    FAR *    png_row_infop;
  289. typedef png_row_info    FAR * FAR * png_row_infopp;
  290.  
  291. /* These are the function types for the I/O functions, and the functions which
  292.  * modify the default I/O functions to user I/O functions.  The png_error_ptr
  293.  * type should match that of user supplied warning and error functions, while
  294.  * the png_rw_ptr type should match that of the user read/write data functions.
  295.  */
  296. typedef struct png_struct_def png_struct;
  297. typedef png_struct FAR * png_structp;
  298.  
  299. typedef void (*png_error_ptr) PNGARG((png_structp, png_const_charp));
  300. typedef void (*png_rw_ptr) PNGARG((png_structp, png_bytep, png_uint_32));
  301. typedef void (*png_flush_ptr) PNGARG((png_structp));
  302. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  303. typedef void (*png_progressive_info_ptr) PNGARG((png_structp, png_infop));
  304. typedef void (*png_progressive_end_ptr) PNGARG((png_structp, png_infop));
  305. typedef void (*png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
  306.    png_uint_32, int));
  307. #endif
  308.  
  309. /* The structure that holds the information to read and write png files.
  310.    The only people who need to care about what is inside of this are the
  311.    people who will be modifying the library for their own special needs.
  312.    */
  313.  
  314. struct png_struct_def
  315. {
  316.    jmp_buf jmpbuf; /* used in png_error */
  317.  
  318.    png_error_ptr error_fn;    /* Function for printing errors and aborting */
  319.    png_error_ptr warning_fn;  /* Function for printing warnings */
  320.    png_voidp error_ptr;       /* user supplied struct for error functions */
  321.    png_rw_ptr write_data_fn;  /* Function for writing output data */
  322.    png_rw_ptr read_data_fn;   /* Function for reading input data */
  323.    png_voidp io_ptr;  /* Pointer to user supplied struct for I/O functions */
  324.  
  325.    png_uint_32 mode; /* used to determine where we are in the png file */
  326.    png_uint_32 flags;  /* flags indicating various things to libpng */
  327.    png_uint_32 transformations; /* which transformations to perform */
  328.  
  329.    z_stream zstream; /* pointer to decompression structure (below) */
  330.    png_bytep zbuf; /* buffer for zlib */
  331.    png_uint_32 zbuf_size; /* size of zbuf */
  332.    int zlib_level; /* holds zlib compression level */
  333.    int zlib_method; /* holds zlib compression method */
  334.    int zlib_window_bits; /* holds zlib compression window bits */
  335.    int zlib_mem_level; /* holds zlib compression memory level */
  336.    int zlib_strategy; /* holds zlib compression strategy */
  337.  
  338.    png_uint_32 width; /* width of file */
  339.    png_uint_32 height; /* height of file */
  340.    png_uint_32 num_rows; /* number of rows in current pass */
  341.    png_uint_32 rowbytes; /* size of row in bytes */
  342.    png_uint_32 usr_width; /* width of row at start of write */
  343.    png_uint_32 iwidth; /* interlaced width */
  344.    png_uint_32 irowbytes; /* interlaced rowbytes */
  345.    png_uint_32 row_number; /* current row in pass */
  346.    png_bytep prev_row; /* place to save previous (unfiltered) row */
  347.    png_bytep row_buf; /* place to save current (unfiltered) row */
  348.    png_bytep sub_row;  /* place to save "sub" row when filtering */
  349.    png_bytep up_row;   /* place to save "up" row when filtering */
  350.    png_bytep avg_row;  /* place to save "avg" row when filtering */
  351.    png_bytep paeth_row; /* place to save "Paeth" row when filtering */
  352.    png_row_info row_info; /* used for transformation routines */
  353.  
  354.    png_uint_32 idat_size; /* current idat size for read */
  355.    png_uint_32 crc; /* current crc value */
  356.    png_colorp palette; /* files palette */
  357.    png_uint_16 num_palette; /* number of entries in palette */
  358.    png_uint_16 num_trans; /* number of transparency values */
  359.    png_byte chunk_name[5]; /* name of current chunk being processed + '\0' */
  360.    png_byte compression; /* file compression type (currently only '0' used) */
  361.    png_byte filter; /* file filter type (currently only '0' used) */
  362.    png_byte interlaced; /* file interlace type (currently only '0' and '1') */
  363.    png_byte pass; /* current interlace pass (0 - 6) */
  364.    png_byte do_filter; /* zero if not row filtering, non-zero if filtering */
  365.    png_byte color_type; /* color type of file */
  366.    png_byte bit_depth; /* bit depth of file */
  367.    png_byte usr_bit_depth; /* bit depth of users row */
  368.    png_byte pixel_depth; /* number of bits per pixel */
  369.    png_byte channels; /* number of channels in file */
  370.    png_byte usr_channels; /* channels at start of write */
  371.    png_byte sig_bytes; /* signature bytes read/written from start of file */
  372.  
  373.  
  374. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  375.    png_byte filler; /* filler byte to be used for 32-bit frame buffers */
  376. #endif
  377. #if defined(PNG_READ_BACKGROUND_SUPPORTED)
  378.    png_byte background_gamma_type;
  379.    float background_gamma;
  380.    png_color_16 background; /* background color, gamma corrected for screen */
  381. #if defined(PNG_READ_GAMMA_SUPPORTED)
  382.    png_color_16 background_1; /* background normalized to gamma 1.0 */
  383. #endif
  384. #endif
  385. #if defined(PNG_WRITE_FLUSH_SUPPORTED)
  386.    png_flush_ptr output_flush_fn;/* Function for flushing output */
  387.    png_uint_32 flush_dist;  /* how many rows apart to flush, 0 for no flush */
  388.    png_uint_32 flush_rows;  /* number of rows written since last flush */
  389. #endif /* PNG_WRITE_FLUSH_SUPPORTED */
  390. #if defined(PNG_READ_GAMMA_SUPPORTED)
  391.    int gamma_shift; /* amount of shift for 16 bit gammas */
  392.    float gamma; /* file gamma value */
  393.    float display_gamma; /* display gamma value */
  394. #endif
  395. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  396.    png_bytep gamma_table; /* gamma table for 8 bit depth files */
  397.    png_bytep gamma_from_1; /* converts from 1.0 to screen */
  398.    png_bytep gamma_to_1; /* converts from file to 1.0 */
  399.    png_uint_16pp gamma_16_table; /* gamma table for 16 bit depth files */
  400.    png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
  401.    png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
  402. #endif
  403. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED)
  404.    png_color_8 sig_bit; /* significant bits in file */
  405. #endif
  406. #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  407.    png_bytep trans; /* transparency values for paletted files */
  408.    png_color_16 trans_values; /* transparency values for non-paletted files */
  409. #endif
  410. #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
  411.    png_color_8 shift; /* shift for significant bit tranformation */
  412. #endif
  413. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  414.    png_progressive_info_ptr info_fn;
  415.    png_progressive_row_ptr row_fn;
  416.    png_progressive_end_ptr end_fn;
  417.    png_bytep save_buffer_ptr;
  418.    png_bytep save_buffer;
  419.    png_bytep current_buffer_ptr;
  420.    png_bytep current_buffer;
  421.    png_uint_32 push_length;
  422.    png_uint_32 skip_length;
  423.    png_uint_32 save_buffer_size;
  424.    png_uint_32 save_buffer_max;
  425.    png_uint_32 buffer_size;
  426.    png_uint_32 current_buffer_size;
  427.    int process_mode;
  428.    int cur_palette;
  429. #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
  430.    png_uint_32 current_text_size;
  431.    png_uint_32 current_text_left;
  432.    png_charp current_text;
  433.    png_charp current_text_ptr;
  434. #endif
  435. #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
  436. /* for the Borland special 64K segment handler */
  437.    png_bytepp offset_table_ptr;
  438.    png_bytep offset_table;
  439.    png_uint_16 offset_table_number;
  440.    png_uint_16 offset_table_count;
  441.    png_uint_16 offset_table_count_free;
  442. #endif
  443. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  444. #if defined(PNG_READ_DITHER_SUPPORTED)
  445.    png_bytep palette_lookup; /* lookup table for dithering */
  446.    png_bytep dither_index; /* index translation for palette files */
  447.    png_uint_16p hist; /* histogram */
  448. #endif
  449. };
  450.  
  451. typedef png_struct      FAR * FAR * png_structpp;
  452.  
  453. /* Here are the function definitions most commonly used.  This is not
  454.    the place to find out how to use libpng.  See libpng.txt for the
  455.    full explanation, see example.c for the summary.  This just provides
  456.    a simple one line of the use of each function. */
  457.  
  458. /* Tell lib we have already handled the first <num_bytes> magic bytes.
  459.    Handling more than 8 bytes from the beginning of the file is an error. */
  460. extern void png_set_sig_bytes PNGARG((png_structp png_ptr, int num_bytes));
  461.  
  462. /* Check sig[start] through sig[start + num_to_check] to see if it's a PNG
  463.    file.  Returns zero if the supplied bytes match the 8-byte PNG signature,
  464.    and non-zero otherwise.  Having num_to_check == 0 or start > 7 will
  465.    always fail (ie return non-zero). */
  466. extern int png_sig_cmp PNGARG((png_bytep sig, int start, int num_to_check));
  467.  
  468. /* (Obsolete) signature checking function.  This is the same as calling
  469.    png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).  To be removed in a
  470.    future version. */
  471. extern int png_check_sig PNGARG((png_bytep sig, int num));
  472.  
  473. /* Allocate and initialize png structure for reading, and any other memory. */
  474. extern png_structp png_create_read_struct PNGARG((png_const_charp user_png_ver,
  475.    voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn));
  476.  
  477. /* initialize png structure for reading, and allocate any other memory (old) */
  478. extern void png_read_init PNGARG((png_structp png_ptr));
  479.  
  480. /* allocate and initialize png structure for reading, and any other memory */
  481. extern png_structp png_create_write_struct
  482.    PNGARG((png_const_charp user_png_ver, voidp error_ptr,
  483.    png_error_ptr error_fn, png_error_ptr warn_fn));
  484.  
  485. /* initialize png structure for writing, and allocate any other memory (old) */
  486. extern void png_write_init PNGARG((png_structp png_ptr));
  487.  
  488. /* allocate and initialize the info structure */
  489. extern png_infop png_create_info_struct PNGARG((png_structp png_ptr));
  490.  
  491. /* initialize the info structure (old interface) */
  492. extern void png_info_init PNGARG((png_infop info_ptr));
  493.  
  494. /* Writes all the png information before the image. */
  495. extern void png_write_info PNGARG((png_structp png_ptr, png_infop info_ptr));
  496.  
  497. /* read the information before the actual image data. */
  498. extern void png_read_info PNGARG((png_structp png_ptr, png_infop info_ptr));
  499.  
  500. #if defined(PNG_WRITE_tIME_SUPPORTED)
  501. /* convert from a struct tm to png_time */
  502. extern void png_convert_from_struct_tm PNGARG((png_timep ptime,
  503.    struct tm FAR * ttime));
  504.  
  505. /* convert from time_t to png_time.  Uses gmtime() */
  506. extern void png_convert_from_time_t PNGARG((png_timep ptime, time_t ttime));
  507. #endif
  508.  
  509. #if defined(PNG_READ_EXPAND_SUPPORTED)
  510. /* Expand the data to 24 bit RGB, or 8 bit Grayscale,
  511.    with alpha if necessary. */
  512. extern void png_set_expand PNGARG((png_structp png_ptr));
  513. #endif
  514.  
  515. #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
  516. /* Use blue, green, red order for pixels. */
  517. extern void png_set_bgr PNGARG((png_structp png_ptr));
  518. #endif
  519.  
  520. #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
  521. /* Expand the grayscale to 24 bit RGB if necessary. */
  522. extern void png_set_gray_to_rgb PNGARG((png_structp png_ptr));
  523. #endif
  524.  
  525. #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
  526. /* Reduce RGB to grayscale. (Not yet implemented) */
  527. extern void png_set_rgb_to_gray PNGARG((png_structp png_ptr));
  528. #endif
  529.  
  530. extern void png_build_grayscale_palette PNGARG((int bit_depth,
  531.    png_colorp palette));
  532.  
  533. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  534. #define PNG_FILLER_BEFORE 0
  535. #define PNG_FILLER_AFTER 1
  536. /* Add a filler byte to rgb images. */
  537. extern void png_set_filler PNGARG((png_structp png_ptr, png_byte filler,
  538.    int flags));
  539.  
  540. /* Old way of doing this, still supported through 1.x for backwards
  541.    compatability, but should not be used in new code. */
  542.  
  543. /* Add a filler byte to rgb images after the colors. */
  544. extern void png_set_rgbx PNGARG((png_structp png_ptr));
  545.  
  546. /* Add a filler byte to rgb images before the colors. */
  547. extern void png_set_xrgb PNGARG((png_structp png_ptr));
  548. #endif
  549.  
  550. #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
  551. /* Swap bytes in 16 bit depth files. */
  552. extern void png_set_swap PNGARG((png_structp png_ptr));
  553. #endif
  554.  
  555. #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
  556. /* Use 1 byte per pixel in 1, 2, or 4 bit depth files. */
  557. extern void png_set_packing PNGARG((png_structp png_ptr));
  558. #endif
  559.  
  560. #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
  561. /* Converts files to legal bit depths. */
  562. extern void png_set_shift PNGARG((png_structp png_ptr,
  563.    png_color_8p true_bits));
  564. #endif
  565.  
  566. #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
  567.     defined(PNG_WRITE_INTERLACING_SUPPORTED)
  568. /* Have the code handle the interlacing.  Returns the number of passes. */
  569. extern int png_set_interlace_handling PNGARG((png_structp png_ptr));
  570. #endif
  571.  
  572. #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
  573. /* Invert monocrome files */
  574. extern void png_set_invert_mono PNGARG((png_structp png_ptr));
  575. #endif
  576.  
  577. #if defined(PNG_READ_BACKGROUND_SUPPORTED)
  578. /* Handle alpha and tRNS by replacing with a background color. */
  579. #define PNG_BACKGROUND_GAMMA_UNKNOWN 0
  580. #define PNG_BACKGROUND_GAMMA_SCREEN  1
  581. #define PNG_BACKGROUND_GAMMA_FILE    2
  582. #define PNG_BACKGROUND_GAMMA_UNIQUE  3
  583. extern void png_set_background PNGARG((png_structp png_ptr,
  584.    png_color_16p background_color, int background_gamma_code,
  585.    int need_expand, double background_gamma));
  586. #endif
  587.  
  588. #if defined(PNG_READ_16_TO_8_SUPPORTED)
  589. /* strip the second byte of information from a 16 bit depth file. */
  590. extern void png_set_strip_16 PNGARG((png_structp png_ptr));
  591. #endif
  592.  
  593. #if defined(PNG_READ_DITHER_SUPPORTED)
  594. /* Turn on dithering, and reduce the palette to the number of colors available. */
  595. extern void png_set_dither PNGARG((png_structp png_ptr, png_colorp palette,
  596.    int num_palette, int maximum_colors, png_uint_16p histogram,
  597.    int full_dither));
  598. #endif
  599.  
  600. #if defined(PNG_READ_GAMMA_SUPPORTED)
  601. /* Handle gamma correction. */
  602. extern void png_set_gamma PNGARG((png_structp png_ptr, double screen_gamma,
  603.    double default_file_gamma));
  604. #endif
  605.  
  606. #if defined(PNG_WRITE_FLUSH_SUPPORTED)
  607. /* Set how many lines between output flushes - 0 for no flushing */
  608. extern void png_set_flush PNGARG((png_structp png_ptr, int nrows));
  609.  
  610. /* Flush the current PNG output buffer */
  611. extern void png_write_flush PNGARG((png_structp png_ptr));
  612. #endif /* PNG_WRITE_FLUSH_SUPPORTED */
  613.  
  614. /* optional update palette with requested transformations */
  615. extern void png_start_read_image PNGARG((png_structp png_ptr));
  616.  
  617. /* optional call to update the users info structure */
  618. extern void png_read_update_info PNGARG((png_structp png_ptr,
  619.    png_infop info_ptr));
  620.  
  621. /* read a one or more rows of image data.*/
  622. extern void png_read_rows PNGARG((png_structp png_ptr,
  623.    png_bytepp row,
  624.    png_bytepp display_row, png_uint_32 num_rows));
  625.  
  626. /* read a row of data.*/
  627. extern void png_read_row PNGARG((png_structp png_ptr,
  628.    png_bytep row,
  629.    png_bytep display_row));
  630.  
  631. /* read the whole image into memory at once. */
  632. extern void png_read_image PNGARG((png_structp png_ptr,
  633.    png_bytepp image));
  634.  
  635. /* write a row of image data */
  636. extern void png_write_row PNGARG((png_structp png_ptr,
  637.    png_bytep row));
  638.  
  639. /* write a few rows of image data */
  640. extern void png_write_rows PNGARG((png_structp png_ptr,
  641.    png_bytepp row,
  642.    png_uint_32 num_rows));
  643.  
  644. /* write the image data */
  645. extern void png_write_image PNGARG((png_structp png_ptr, png_bytepp image));
  646.  
  647. /* writes the end of the png file. */
  648. extern void png_write_end PNGARG((png_structp png_ptr, png_infop info_ptr));
  649.  
  650. /* read the end of the png file. */
  651. extern void png_read_end PNGARG((png_structp png_ptr, png_infop info_ptr));
  652.  
  653. /* free any memory associated with the info_struct */
  654. extern void png_destroy_info_struct PNGARG((png_structp png_ptr,
  655.    png_infopp info_ptr_ptr));
  656.  
  657. /* free any memory associated with the png_struct and the info_structs */
  658. extern void png_destroy_read_struct PNGARG((png_structpp png_ptr_ptr,
  659.    png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
  660.  
  661. /* free all memory used by the read (old method) */
  662. extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
  663.    png_infop end_info_ptr));
  664.  
  665. /* free any memory associated with the png_struct and the info_structs */
  666. extern void png_destroy_write_struct PNGARG((png_structpp png_ptr_ptr,
  667.    png_infopp info_ptr_ptr));
  668.  
  669. /* free any memory used in png struct */
  670. extern void png_write_destroy PNGARG((png_structp png_ptr));
  671.  
  672. /* set the libpng method of handling chunk CRC errors */
  673. extern void png_set_crc_action PNGARG((png_structp png_ptr, int crit_action,
  674.    int ancil_action));
  675.  
  676. /* Values for png_set_crc_action() to say how to handle CRC errors in
  677.    ancillary and critical chunks, and whether to use the data contained
  678.    therein.  Note that it is impossible to "discard" data in a critical
  679.    chunk.  For versions prior to 0.90, the action was always error/quit,
  680.    whereas in version 0.90, the action for CRC errors in ancillary
  681.    chunks is warn/discard.
  682.  
  683.         value                       action:critical     action:ancillary
  684.  */
  685. #define PNG_CRC_DEFAULT       0  /* error/quit          warn/discard data */
  686. #define PNG_CRC_ERROR_QUIT    1  /* error/quit          error/quit        */
  687. #define PNG_CRC_WARN_DISCARD  2  /* (INVALID)           warn/discard data */
  688. #define PNG_CRC_WARN_USE      3  /* warn/use data       warn/use data     */
  689. #define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use data    */
  690. #define PNG_CRC_NO_CHANGE     5  /* use current value   use current value */
  691.  
  692. /* These functions give the user control over the scan-line filtering
  693.    in libpng and the compression methods used by zlib.  These functions are
  694.    mainly useful for testing, as the defaults should work with most users.
  695.    Those users who are tight on memory, or are wanting faster performance
  696.    at the expense of compression can modify them.  See the compression
  697.    library header file for an explination of the compression functions */
  698.  
  699. /* set the filtering method(s) used by libpng */
  700. extern void png_set_filter PNGARG((png_structp png_ptr, int method,
  701.    int filters));
  702.  
  703. /* Flags for png_set_filter() to say which filters to use.  The flags
  704.    are chosen so that they don't conflict with real filter types, in case they
  705.    are supplied instead of the #defined constants.
  706.  */
  707. #define PNG_NO_FILTERS     0x00
  708. #define PNG_FILTER_NONE    0x08
  709. #define PNG_FILTER_SUB     0x10
  710. #define PNG_FILTER_UP      0x20
  711. #define PNG_FILTER_AVG     0x40
  712. #define PNG_FILTER_PAETH   0x80
  713. #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
  714.                          PNG_FILTER_AVG | PNG_FILTER_PAETH)
  715.  
  716. extern void png_set_compression_level PNGARG((png_structp png_ptr,
  717.    int level));
  718.  
  719. extern void png_set_compression_mem_level PNGARG((png_structp png_ptr,
  720.    int mem_level));
  721.  
  722. extern void png_set_compression_strategy PNGARG((png_structp png_ptr,
  723.    int strategy));
  724.  
  725. extern void png_set_compression_window_bits PNGARG((png_structp png_ptr,
  726.    int window_bits));
  727.  
  728. extern void png_set_compression_method PNGARG((png_structp png_ptr,
  729.    int method));
  730.  
  731. /* These next functions are called for input/output, memory, and error
  732.    handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,
  733.    and call standard C I/O routines such as fread(), fwrite(), and
  734.    fprintf().  These functions can be made to use other I/O routines
  735.    at run time for those applications that need to handle I/O in a
  736.    different manner by calling png_set_???_fn().  See libpng.txt for
  737.    more information */
  738.  
  739. /* Write the data to whatever output you are using. */
  740. extern void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
  741.    png_uint_32 length));
  742.  
  743. /* Read data from whatever input you are using */
  744. extern void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
  745.    png_uint_32 length));
  746.  
  747. /* Initialize the input/output for the png file to the default functions. */
  748. extern void png_init_io PNGARG((png_structp png_ptr, FILE *fp));
  749.  
  750. /* Replace the (error and abort), and warning functions with user
  751.    supplied functions.  If no messages are to be printed you must still
  752.    write and use replacement functions. The replacement error_fn should
  753.    still do a longjmp to the last setjmp location if you are using this
  754.    method of error handling.  If error_fn or warning_fn is NULL, the
  755.    default function will be used. */
  756. extern void png_set_error_fn PNGARG((png_structp png_ptr, png_voidp error_ptr,
  757.    png_error_ptr error_fn, png_error_ptr warning_fn));
  758.  
  759. /* Return the user pointer associated with the error functions */
  760. extern png_voidp png_get_error_ptr PNGARG((png_structp png_ptr));
  761.  
  762. /* Replace the default data output functions with a user supplied one(s).
  763.    If buffered output is not used, then output_flush_fn can be set to NULL.
  764.    If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
  765.    output_flush_fn will be ignored (and thus can be NULL). */
  766. extern void png_set_write_fn PNGARG((png_structp png_ptr, png_voidp io_ptr,
  767.    png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
  768.  
  769. /* Replace the default data input function with a user supplied one. */
  770. extern void png_set_read_fn PNGARG((png_structp png_ptr, png_voidp io_ptr,
  771.    png_rw_ptr read_data_fn));
  772.  
  773. /* Return the user pointer associated with the I/O functions */
  774. extern png_voidp png_get_io_ptr PNGARG((png_structp png_ptr));
  775.  
  776. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  777. /* Replace the default push model read functions */
  778. extern void png_set_push_fn PNGARG((png_structp png_ptr, png_voidp push_ptr,
  779.    png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
  780.    png_progressive_end_ptr end_fn));
  781.  
  782. /* returns the user pointer associated with the push read functions */
  783. extern png_voidp png_get_progressive_ptr PNGARG((png_structp png_ptr));
  784. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  785.  
  786. extern png_voidp png_malloc PNGARG((png_structp png_ptr,
  787.    png_uint_32 size));
  788.  
  789. /* free's a pointer allocated by png_malloc() */
  790. extern void png_free PNGARG((png_structp png_ptr, png_voidp ptr));
  791.  
  792. /* Fatal error in libpng - can't continue */ 
  793. extern void png_error PNGARG((png_structp png_ptr, png_const_charp error));
  794.  
  795. /* Non-fatal error in libpng.  Can continue, but may have a problem. */
  796. extern void png_warning PNGARG((png_structp png_ptr, png_const_charp message));
  797.  
  798. /* These next functions are used internally in the code.  If you use
  799.    them, make sure you read and understand the png spec.  More information
  800.    about them can be found in the files where the functions are.
  801.    Feel free to move any of these outside the PNG_INTERNAL define if
  802.    you just need a few of them, but if you need access to more, you should
  803.    define PNG_INTERNAL inside your code, so everyone who includes png.h
  804.    won't get yet another definition the compiler has to deal with. */
  805.  
  806. #if defined(PNG_INTERNAL)
  807.  
  808. /* Various modes of operation.  Note that after an init, mode is set to
  809.    zero automatically when the structure is created. */
  810. #define PNG_BEFORE_IHDR       0x00
  811. #define PNG_HAVE_IHDR         0x01
  812. #define PNG_HAVE_PLTE         0x02
  813. #define PNG_HAVE_IDAT         0x04
  814. #define PNG_AFTER_IDAT        0x08
  815. #define PNG_HAVE_IEND         0x10
  816.  
  817. /* push model modes */
  818. #define PNG_READ_SIG_MODE   0
  819. #define PNG_READ_CHUNK_MODE 1
  820. #define PNG_READ_IDAT_MODE  2
  821. #define PNG_READ_END_MODE   3
  822. #define PNG_SKIP_MODE       4
  823. #define PNG_READ_tEXt_MODE  5
  824. #define PNG_READ_zTXt_MODE  6
  825. #define PNG_READ_DONE_MODE  7
  826. #define PNG_ERROR_MODE      8
  827.  
  828. /* defines for the transformations the PNG library does on the image data */
  829. #define PNG_BGR                0x0001
  830. #define PNG_INTERLACE          0x0002
  831. #define PNG_PACK               0x0004
  832. #define PNG_SHIFT              0x0008
  833. #define PNG_SWAP_BYTES         0x0010
  834. #define PNG_INVERT_MONO        0x0020
  835. #define PNG_DITHER             0x0040
  836. #define PNG_BACKGROUND         0x0080
  837. #define PNG_BACKGROUND_EXPAND  0x0100
  838. #define PNG_RGB_TO_GRAY        0x0200
  839. #define PNG_16_TO_8            0x0400
  840. #define PNG_RGBA               0x0800
  841. #define PNG_EXPAND             0x1000
  842. #define PNG_GAMMA              0x2000
  843. #define PNG_GRAY_TO_RGB        0x4000
  844. #define PNG_FILLER             0x8000
  845.  
  846. /* flags for png_create_struct */
  847. #define PNG_STRUCT_PNG   0x0001
  848. #define PNG_STRUCT_INFO  0x0002
  849.  
  850. /* flags for the png_ptr->flags rather than declaring a bye for each one */
  851. #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001
  852. #define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002
  853. #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004
  854. #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008
  855. #define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010
  856. #define PNG_FLAG_ZLIB_FINISHED            0x0020
  857. #define PNG_FLAG_ROW_INIT                 0x0040
  858. #define PNG_FLAG_FILLER_AFTER             0x0080
  859. #define PNG_FLAG_CRC_ANCILLARY_USE        0x0100
  860. #define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200
  861. #define PNG_FLAG_CRC_CRITICAL_USE         0x0400
  862. #define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800
  863. #define PNG_FLAG_FREE_PALETTE             0x1000
  864. #define PNG_FLAG_FREE_TRANS               0x2000
  865. #define PNG_FLAG_FREE_HIST                0x4000
  866. #define PNG_FLAG_HAVE_CHUNK_HEADER        0x8000
  867. #define PNG_FLAG_WROTE_tIME              0x10000
  868.  
  869. #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
  870.                                      PNG_FLAG_CRC_ANCILLARY_NOWARN)
  871.  
  872. #define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \
  873.                                      PNG_FLAG_CRC_CRITICAL_IGNORE)
  874.  
  875. #define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \
  876.                                      PNG_FLAG_CRC_CRITICAL_MASK)
  877.  
  878. /* save typing and make code easier to understand */
  879. #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
  880.    abs((int)((c1).green) - (int)((c2).green)) + \
  881.    abs((int)((c1).blue) - (int)((c2).blue)))
  882.  
  883. /* variables defined in png.c - only it needs to define PNG_NO_EXTERN */
  884. #ifndef PNG_NO_EXTERN
  885. /* place to hold the signiture string for a png file. */
  886. extern png_byte FARDATA png_sig[];
  887.  
  888. /* version information for c files, stored in png.c. */
  889. extern char png_libpng_ver[];
  890.  
  891. /* constant strings for known chunk types.  If you need to add a chunk,
  892.    add a string holding the name here.  See png.c for more details.  We
  893.    can't selectively include these, since we still check for chunk in the
  894.    wrong locations with these labels. */
  895. extern png_byte FARDATA png_IHDR[];
  896. extern png_byte FARDATA png_IDAT[];
  897. extern png_byte FARDATA png_IEND[];
  898. extern png_byte FARDATA png_PLTE[];
  899. extern png_byte FARDATA png_gAMA[];
  900. extern png_byte FARDATA png_sBIT[];
  901. extern png_byte FARDATA png_cHRM[];
  902. extern png_byte FARDATA png_tRNS[];
  903. extern png_byte FARDATA png_bKGD[];
  904. extern png_byte FARDATA png_hIST[];
  905. extern png_byte FARDATA png_tEXt[];
  906. extern png_byte FARDATA png_zTXt[];
  907. extern png_byte FARDATA png_pHYs[];
  908. extern png_byte FARDATA png_oFFs[];
  909. extern png_byte FARDATA png_tIME[];
  910. /* Structures to facilitate easy interlacing.  See png.c for more details */
  911. extern int FARDATA png_pass_start[];
  912. extern int FARDATA png_pass_inc[];
  913. extern int FARDATA png_pass_ystart[];
  914. extern int FARDATA png_pass_yinc[];
  915. /* these are not currently used.  If you need them, see png.c
  916. extern int FARDATA png_pass_width[];
  917. extern int FARDATA png_pass_height[];
  918. */
  919. extern int FARDATA png_pass_mask[];
  920. extern int FARDATA png_pass_dsp_mask[];
  921.  
  922. #endif /* PNG_NO_EXTERN */
  923.  
  924. /* allocate memory for an internal libpng struct */
  925. extern png_voidp png_create_struct PNGARG((int type));
  926.  
  927. /* free memory from internal libpng struct */
  928. extern void png_destroy_struct PNGARG((png_voidp struct_ptr));
  929.  
  930. /* free any memory that info_ptr points to and reset struct. */
  931. extern void png_info_destroy PNGARG((png_structp png_ptr,
  932.    png_infop info_ptr));
  933.  
  934. /* Function to allocate memory for zlib. */
  935. extern voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
  936.  
  937. /* function to free memory for zlib */
  938. extern void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
  939.  
  940. /* reset the CRC variable */
  941. extern void png_reset_crc PNGARG((png_structp png_ptr));
  942.  
  943. /* read bytes into buf, and update png_ptr->crc */
  944. extern void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
  945.    png_uint_32 length));
  946.  
  947. /* read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
  948. extern int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
  949.  
  950. /* read the CRC from the file and compare it to the libpng calculated CRC */
  951. extern int png_crc_error PNGARG((png_structp png_ptr));
  952.  
  953. /* calculate the crc over a section of data.  Note that while we
  954.    are passing in a 32 bit value for length, on 16 bit machines, you
  955.    would need to use huge pointers to access all that data.  See the
  956.    code in png.c for more information. */
  957. extern void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
  958.    png_uint_32 length));
  959.  
  960. #if defined(PNG_WRITE_FLUSH_SUPPORTED)
  961. extern void png_flush PNGARG((png_structp png_ptr));
  962. #endif
  963.  
  964. /* place a 32 bit number into a buffer in png byte order.  We work
  965.    with unsigned numbers for convenience, you may have to cast
  966.    signed numbers (if you use any, most png data is unsigned). */
  967. extern void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
  968.  
  969. /* place a 16 bit number into a buffer in png byte order */
  970. extern void png_save_uint_16 PNGARG((png_bytep buf, png_uint_16 i));
  971.  
  972. /* write a 32 bit number */
  973. extern void png_write_uint_32 PNGARG((png_structp png_ptr, png_uint_32 i));
  974.  
  975. /* write a 16 bit number */
  976. extern void png_write_uint_16 PNGARG((png_structp png_ptr, png_uint_16 i));
  977.  
  978. /* Write a png chunk.  */
  979. extern void png_write_chunk PNGARG((png_structp png_ptr, png_bytep chunk_name,
  980.    png_bytep data, png_uint_32 length));
  981.  
  982. /* Write the start of a png chunk. */
  983. extern void png_write_chunk_start PNGARG((png_structp png_ptr, png_bytep chunk_name,
  984.    png_uint_32 length));
  985.  
  986. /* write the data of a png chunk started with png_write_chunk_start(). */
  987. extern void png_write_chunk_data PNGARG((png_structp png_ptr, png_bytep data,
  988.    png_uint_32 length));
  989.  
  990. /* finish a chunk started with png_write_chunk_start() */
  991. extern void png_write_chunk_end PNGARG((png_structp png_ptr));
  992.  
  993. /* simple function to write the signiture */
  994. extern void png_write_sig PNGARG((png_structp png_ptr));
  995.  
  996. /* write various chunks */
  997.  
  998. /* Write the IHDR chunk, and update the png_struct with the necessary
  999.    information. */
  1000. extern void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
  1001.    png_uint_32 height,
  1002.    int bit_depth, int color_type, int compression_type, int filter_type,
  1003.    int interlace_type));
  1004.  
  1005. extern void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
  1006.    png_uint_32 number));
  1007.  
  1008. extern void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
  1009.    png_uint_32 length));
  1010.  
  1011. extern void png_write_IEND PNGARG((png_structp png_ptr));
  1012.  
  1013. #if defined(PNG_WRITE_gAMA_SUPPORTED)
  1014. extern void png_write_gAMA PNGARG((png_structp png_ptr, double gamma));
  1015. #endif
  1016.  
  1017. #if defined(PNG_WRITE_sBIT_SUPPORTED)
  1018. extern void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
  1019.    int color_type));
  1020. #endif
  1021.  
  1022. #if defined(PNG_WRITE_cHRM_SUPPORTED)
  1023. extern void png_write_cHRM PNGARG((png_structp png_ptr,
  1024.    double white_x, double white_y,
  1025.    double red_x, double red_y, double green_x, double green_y,
  1026.    double blue_x, double blue_y));
  1027. #endif
  1028.  
  1029. #if defined(PNG_WRITE_tRNS_SUPPORTED)
  1030. extern void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
  1031.    png_color_16p values, int number, int color_type));
  1032. #endif
  1033.  
  1034. #if defined(PNG_WRITE_bKGD_SUPPORTED)
  1035. extern void png_write_bKGD PNGARG((png_structp png_ptr, png_color_16p values,
  1036.    int color_type));
  1037. #endif
  1038.  
  1039. #if defined(PNG_WRITE_hIST_SUPPORTED)
  1040. extern void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
  1041.    int number));
  1042. #endif
  1043.  
  1044. #if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
  1045. extern int png_check_keyword PNGARG((png_structp png_ptr, png_charpp key));
  1046. #endif
  1047.  
  1048. #if defined(PNG_WRITE_tEXt_SUPPORTED)
  1049. extern void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
  1050.    png_charp text, png_uint_32 text_len));
  1051. #endif
  1052.  
  1053. #if defined(PNG_WRITE_zTXt_SUPPORTED)
  1054. extern void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
  1055.    png_charp text, png_uint_32 text_len, int compression));
  1056. #endif
  1057.  
  1058. #if defined(PNG_WRITE_pHYs_SUPPORTED)
  1059. extern void png_write_pHYs PNGARG((png_structp png_ptr,
  1060.    png_uint_32 x_pixels_per_unit,
  1061.    png_uint_32 y_pixels_per_unit,
  1062.    int unit_type));
  1063. #endif
  1064.  
  1065. #if defined(PNG_WRITE_oFFs_SUPPORTED)
  1066. extern void png_write_oFFs PNGARG((png_structp png_ptr,
  1067.    png_uint_32 x_offset,
  1068.    png_uint_32 y_offset,
  1069.    int unit_type));
  1070. #endif
  1071.  
  1072. #if defined(PNG_WRITE_tIME_SUPPORTED)
  1073. extern void png_write_tIME PNGARG((png_structp png_ptr, png_timep mod_time));
  1074. #endif
  1075.  
  1076. /* Internal use only.   Called when finished processing a row of data */
  1077. extern void png_write_finish_row PNGARG((png_structp png_ptr));
  1078.  
  1079. /* Internal use only.   Called before first row of data */
  1080. extern void png_write_start_row PNGARG((png_structp png_ptr));
  1081.  
  1082. /* callbacks for png chunks */
  1083. extern void png_read_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
  1084.    png_uint_32 width, png_uint_32 height, int bit_depth,
  1085.    int color_type, int compression_type, int filter_type,
  1086.    int interlace_type));
  1087.  
  1088. extern void png_read_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
  1089.    png_colorp palette, int num));
  1090.  
  1091. #if defined(PNG_READ_gAMA_SUPPORTED)
  1092. extern void png_read_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
  1093.    double gamma));
  1094. #endif
  1095.  
  1096. #if defined(PNG_READ_sBIT_SUPPORTED)
  1097. extern void png_read_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
  1098.    png_color_8p sig_bit));
  1099. #endif
  1100.  
  1101. #if defined(PNG_READ_cHRM_SUPPORTED)
  1102. extern void png_read_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
  1103.    double white_x, double white_y, double red_x, double red_y,
  1104.    double green_x, double green_y, double blue_x, double blue_y));
  1105. #endif
  1106.  
  1107. #if defined(PNG_READ_tRNS_SUPPORTED)
  1108. extern void png_read_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
  1109.    png_bytep trans, int num_trans,   png_color_16p trans_values));
  1110. #endif
  1111.  
  1112. #if defined(PNG_READ_bKGD_SUPPORTED)
  1113. extern void png_read_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
  1114.    png_color_16p background));
  1115. #endif
  1116.  
  1117. #if defined(PNG_READ_hIST_SUPPORTED)
  1118. extern void png_read_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
  1119.    png_uint_16p hist));
  1120. #endif
  1121.  
  1122. #if defined(PNG_READ_pHYs_SUPPORTED)
  1123. extern void png_read_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
  1124.    png_uint_32 res_x, png_uint_32 res_y, int unit_type));
  1125. #endif
  1126.  
  1127. #if defined(PNG_READ_oFFs_SUPPORTED)
  1128. extern void png_read_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
  1129.    png_uint_32 offset_x, png_uint_32 offset_y, int unit_type));
  1130. #endif
  1131.  
  1132. #if defined(PNG_READ_tIME_SUPPORTED)
  1133. extern void png_read_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
  1134.    png_timep mod_time));
  1135. #endif
  1136.  
  1137. #if defined(PNG_READ_tEXt_SUPPORTED)
  1138. extern void png_read_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  1139.    png_charp key, png_charp text, png_uint_32 text_len));
  1140. #endif
  1141.  
  1142. #if defined(PNG_READ_zTXt_SUPPORTED)
  1143. extern void png_read_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  1144.    png_charp key, png_charp text, png_uint_32 text_len, int compression));
  1145. #endif
  1146.  
  1147. #if defined(PNG_READ_GAMMA_SUPPORTED)
  1148. void
  1149. png_build_gamma_table PNGARG((png_structp png_ptr));
  1150. #endif
  1151.  
  1152. /* combine a row of data, dealing with alpha, etc. if requested */
  1153. extern void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
  1154.    int mask));
  1155.  
  1156. #if defined(PNG_READ_INTERLACING_SUPPORTED)
  1157. /* expand an interlaced row */
  1158. extern void png_do_read_interlace PNGARG((png_row_infop row_info,
  1159.    png_bytep row, int pass));
  1160. #endif
  1161.  
  1162. #if defined(PNG_WRITE_INTERLACING_SUPPORTED)
  1163. /* grab pixels out of a row for an interlaced pass */
  1164. extern void png_do_write_interlace PNGARG((png_row_infop row_info,
  1165.    png_bytep row, int pass));
  1166. #endif
  1167.  
  1168. /* unfilter a row */
  1169. extern void png_read_filter_row PNGARG((png_structp png_ptr,
  1170.    png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
  1171. /* choose the best filter to use and filter the row data */
  1172. extern void png_write_find_filter PNGARG((png_structp png_ptr,
  1173.    png_row_infop row_info));
  1174. /* write out the filtered row */
  1175. extern void png_write_filtered_row PNGARG((png_structp png_ptr,
  1176.    png_bytep filtered_row));
  1177. /* finish a row while reading, dealing with interlacing passes, etc. */
  1178. extern void png_read_finish_row PNGARG((png_structp png_ptr));
  1179. /* initialize the row buffers, etc. */
  1180. extern void png_read_start_row PNGARG((png_structp png_ptr));
  1181. /* optional call to update the users info structure */
  1182. extern void png_read_transform_info PNGARG((png_structp png_ptr,
  1183.    png_infop info_ptr));
  1184.  
  1185. /* these are the functions that do the transformations */
  1186. #if defined(PNG_READ_FILLER_SUPPORTED)
  1187. extern void png_do_read_filler PNGARG((png_row_infop row_info,
  1188.    png_bytep row, png_byte filler, png_uint_32 filler_loc));
  1189. #endif
  1190.  
  1191. #if defined(PNG_WRITE_FILLER_SUPPORTED)
  1192. extern void png_do_write_filler PNGARG((png_row_infop row_info,
  1193.    png_bytep row, png_uint_32 filler_loc));
  1194. #endif
  1195.  
  1196. #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
  1197. extern void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
  1198. #endif
  1199.  
  1200. #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
  1201. extern void png_do_rgb_to_gray PNGARG((png_row_infop row_info, png_bytep row));
  1202. #endif
  1203.  
  1204. #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
  1205. extern void png_do_gray_to_rgb PNGARG((png_row_infop row_info, png_bytep row));
  1206. #endif
  1207.  
  1208. #if defined(PNG_READ_PACK_SUPPORTED)
  1209. extern void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
  1210. #endif
  1211.  
  1212. #if defined(PNG_READ_SHIFT_SUPPORTED)
  1213. extern void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
  1214.    png_color_8p sig_bits));
  1215. #endif
  1216.  
  1217. #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
  1218. extern void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
  1219. #endif
  1220.  
  1221. #if defined(PNG_READ_16_TO_8_SUPPORTED)
  1222. extern void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
  1223. #endif
  1224.  
  1225. #if defined(PNG_READ_DITHER_SUPPORTED)
  1226. extern void png_do_dither PNGARG((png_row_infop row_info,
  1227.    png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
  1228. #  if defined(PNG_CORRECT_PALETTE_SUPPORTED)
  1229. extern void png_correct_palette PNGARG((png_structp png_ptr,
  1230.    png_colorp palette, int num_palette));
  1231. #  endif
  1232. #endif
  1233.  
  1234. #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
  1235. extern void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
  1236. #endif
  1237.  
  1238. #if defined(PNG_WRITE_PACK_SUPPORTED)
  1239. extern void png_do_pack PNGARG((png_row_infop row_info,
  1240.    png_bytep row, png_byte bit_depth));
  1241. #endif
  1242.  
  1243. #if defined(PNG_WRITE_SHIFT_SUPPORTED)
  1244. extern void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
  1245.    png_color_8p bit_depth));
  1246. #endif
  1247.  
  1248. #if defined(PNG_READ_BACKGROUND_SUPPORTED)
  1249. extern void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
  1250.    png_color_16p trans_values, png_color_16p background,
  1251.    png_color_16p background_1,
  1252.    png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
  1253.    png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
  1254.    png_uint_16pp gamma_16_to_1, int gamma_shift));
  1255. #endif
  1256.  
  1257. #if defined(PNG_READ_GAMMA_SUPPORTED)
  1258. extern void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
  1259.    png_bytep gamma_table, png_uint_16pp gamma_16_table,
  1260.    int gamma_shift));
  1261. #endif
  1262.  
  1263. #if defined(PNG_READ_EXPAND_SUPPORTED)
  1264. extern void png_do_expand_palette PNGARG((png_row_infop row_info,
  1265.    png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
  1266. extern void png_do_expand PNGARG((png_row_infop row_info,
  1267.    png_bytep row, png_color_16p trans_value));
  1268. #endif
  1269.  
  1270. /* unpack 16 and 32 bit values from a string */
  1271. extern png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
  1272. extern png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
  1273.  
  1274. /* the following decodes the appropriate chunks, and does error correction,
  1275.    then calls the appropriate callback for the chunk if it is valid */
  1276.  
  1277. /* decode the IHDR chunk */
  1278. extern void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
  1279.    png_uint_32 length));
  1280. extern void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
  1281.    png_uint_32 length));
  1282. extern void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
  1283.    png_uint_32 length));
  1284. #if defined(PNG_READ_gAMA_SUPPORTED)
  1285. extern void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
  1286.    png_uint_32 length));
  1287. #endif
  1288.  
  1289. #if defined(PNG_READ_sBIT_SUPPORTED)
  1290. extern void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
  1291.    png_uint_32 length));
  1292. #endif
  1293.  
  1294. #if defined(PNG_READ_cHRM_SUPPORTED)
  1295. extern void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
  1296.    png_uint_32 length));
  1297. #endif
  1298.  
  1299. #if defined(PNG_READ_tRNS_SUPPORTED)
  1300. extern void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
  1301.    png_uint_32 length));
  1302. #endif
  1303.  
  1304. #if defined(PNG_READ_bKGD_SUPPORTED)
  1305. extern void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
  1306.    png_uint_32 length));
  1307. #endif
  1308.  
  1309. #if defined(PNG_READ_hIST_SUPPORTED)
  1310. extern void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
  1311.    png_uint_32 length));
  1312. #endif
  1313.  
  1314. #if defined(PNG_READ_pHYs_SUPPORTED)
  1315. extern void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
  1316.    png_uint_32 length));
  1317. #endif
  1318.  
  1319. #if defined(PNG_READ_oFFs_SUPPORTED)
  1320. extern void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
  1321.    png_uint_32 length));
  1322. #endif
  1323.  
  1324. #if defined(PNG_READ_tIME_SUPPORTED)
  1325. extern void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
  1326.    png_uint_32 length));
  1327. #endif
  1328.  
  1329. #if defined(PNG_READ_tEXt_SUPPORTED)
  1330. extern void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  1331.    png_uint_32 length));
  1332. #endif
  1333.  
  1334. #if defined(PNG_READ_zTXt_SUPPORTED)
  1335. extern void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  1336.    png_uint_32 length));
  1337. #endif
  1338.  
  1339. extern void png_handle_unknown PNGARG((png_structp png_ptr, png_infop info_ptr,
  1340.    png_uint_32 length));
  1341.  
  1342. extern void png_check_chunk_name PNGARG((png_structp png_ptr,
  1343.    png_bytep chunk_name));
  1344.  
  1345. /* handle the transformations for reading and writing */
  1346. extern void png_do_read_transformations PNGARG((png_structp png_ptr));
  1347. extern void png_do_write_transformations PNGARG((png_structp png_ptr));
  1348.  
  1349. extern void png_init_read_transformations PNGARG((png_structp png_ptr));
  1350.  
  1351. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  1352. extern void png_push_read_chunk PNGARG((png_structp png_ptr, png_infop info_ptr));
  1353. extern void png_push_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr));
  1354. extern void png_push_check_crc PNGARG((png_structp png_ptr));
  1355. extern void png_push_crc_skip PNGARG((png_structp png_ptr, png_uint_32 length));
  1356. extern void png_push_skip PNGARG((png_structp png_ptr));
  1357. extern void png_push_fill_buffer PNGARG((png_structp png_ptr, png_bytep buffer,
  1358.    png_uint_32 length));
  1359. extern void png_push_save_buffer PNGARG((png_structp png_ptr));
  1360. extern void png_push_restore_buffer PNGARG((png_structp png_ptr, png_bytep buffer,
  1361.    png_uint_32 buffer_length));
  1362. extern void png_push_read_IDAT PNGARG((png_structp png_ptr));
  1363. extern void png_process_IDAT_data PNGARG((png_structp png_ptr,
  1364.    png_bytep buffer, png_uint_32 buffer_length));
  1365. extern void png_push_process_row PNGARG((png_structp png_ptr));
  1366. extern void png_push_handle_PLTE PNGARG((png_structp png_ptr,
  1367.    png_uint_32 length));
  1368. extern void png_push_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
  1369.    png_uint_32 length));
  1370. extern void png_push_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
  1371.    png_uint_32 length));
  1372. extern void png_push_handle_unknown PNGARG((png_structp png_ptr, png_infop info_ptr,
  1373.    png_uint_32 length));
  1374. extern void png_push_have_info PNGARG((png_structp png_ptr, png_infop info_ptr));
  1375. extern void png_push_have_end PNGARG((png_structp png_ptr, png_infop info_ptr));
  1376. extern void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
  1377. extern void png_push_read_end PNGARG((png_structp png_ptr, png_infop info_ptr));
  1378. extern void png_process_some_data PNGARG((png_structp png_ptr,
  1379.    png_infop info_ptr));
  1380. extern void png_read_push_finish_row PNGARG((png_structp png_ptr));
  1381. #if defined(PNG_READ_tEXt_SUPPORTED)
  1382. extern void png_push_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  1383.    png_uint_32 length));
  1384. extern void png_push_read_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr));
  1385. #endif
  1386. #if defined(PNG_READ_zTXt_SUPPORTED)
  1387. extern void png_push_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  1388.    png_uint_32 length));
  1389. extern void png_push_read_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr));
  1390. #endif
  1391.  
  1392. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  1393.  
  1394. #endif /* PNG_INTERNAL */
  1395.  
  1396. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  1397. extern void png_process_data PNGARG((png_structp png_ptr, png_infop info_ptr,
  1398.    png_bytep buffer, png_uint_32 buffer_size));
  1399. extern void png_set_progressive_read_fn PNGARG((png_structp png_ptr,
  1400.    png_voidp progressive_ptr,
  1401.    png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
  1402.    png_progressive_end_ptr end_fn));
  1403. extern void png_progressive_combine_row PNGARG((png_structp png_ptr,
  1404.    png_bytep old_row, png_bytep new_row));
  1405. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  1406.  
  1407. #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
  1408. extern void *far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,int check));
  1409. #endif /* defined(USE_FAR_KEYWORD) */
  1410.  
  1411. #ifdef __cplusplus
  1412. }
  1413. #endif
  1414.  
  1415. /* do not put anything past this line */
  1416. #endif /* _PNG_H */
  1417.